
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/vue@next"></script>
</head>
<body>
    <div id="root"></div>
    
</body>
<script>


    const app = Vue.createApp({
        components: {
        },
        data(){
            return {
               num: 10002,
               handler: () => {alert(123)}
            }
        },
        methods:{
            
        },
        template:
        `
            <div>
                <test content="10002" :num="num" :handlerFunc="handler"></test>
            </div>
        `
    });

    app.component('test', {
        props: {
            content: Number,
            num: {
                type: Number,
                validator: (val) => {
                    if(val>1000){
                        val=100;
                    }
                    return val<1000;
                },
                default: function(){
                    return 111;
                }
            },
            handlerFunc: Function
        },
        methods: {
            handlerClcik(){
                alert("handlerClick");
                this.handlerFunc();
            }
        },
        template: 
        `
            <div @click="this.handlerClcik">{{content}} == {{num}}</div>
        `
    });

    const vm = app.mount("#root");
</script>
</html>